Skip to content

fix: pass proxy httpAgent to Anthropic SDK (node-fetch based)#11808

Open
p12tic wants to merge 1 commit intoRooCodeInc:mainfrom
p12tic:anthropic-proxy
Open

fix: pass proxy httpAgent to Anthropic SDK (node-fetch based)#11808
p12tic wants to merge 1 commit intoRooCodeInc:mainfrom
p12tic:anthropic-proxy

Conversation

@p12tic
Copy link
Contributor

@p12tic p12tic commented Mar 1, 2026

Related GitHub Issue

Closes: #11807

Roo Code Task Context (Optional)

None..

Description

The Anthropic SDK v0.x uses node-fetch with custom agentkeepalive agents, which bypass VSCode's http/https module proxy patching.

Add https-proxy-agent dependency and getProxyHttpAgent() utility that creates an HttpsProxyAgent from the configured proxy URL. Pass it as httpAgent to all Anthropic/AnthropicVertex client constructors:

  • anthropic.ts
  • minimax.ts (uses Anthropic SDK for Anthropic-compatible endpoint)
  • anthropic-vertex.ts

Test Procedure

  • Setup router firewall to disable all network access from your machine.
  • Setup a HTTP proxy in a different machine
  • Configure HTTP proxy setting in VSCode
  • Attempt to run Roo code with Anthropic. Before the fix it would fail, after the fix it works.

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I have performed a thorough self-review of my code.
  • Testing: New and/or updated tests have been added to cover my changes (if applicable).
  • Documentation Impact: I have considered if my changes require documentation updates (see "Documentation Updates" section below).
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Screenshots / Videos

No UI changes

Documentation Updates

None needed

Additional Notes

None

Get in Touch

povilas_78868

The Anthropic SDK v0.x uses node-fetch with custom agentkeepalive agents,
which bypass VSCode's http/https module proxy patching.

Add https-proxy-agent dependency and getProxyHttpAgent() utility that
creates an HttpsProxyAgent from the configured proxy URL. Pass it as
httpAgent to all Anthropic/AnthropicVertex client constructors:
- anthropic.ts
- minimax.ts (uses Anthropic SDK for Anthropic-compatible endpoint)
- anthropic-vertex.ts
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. bug Something isn't working labels Mar 1, 2026
@hannesrudolph
Copy link
Collaborator

@roomote review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] HTTP proxy is ignored on Anthropic provider

2 participants